<template>
  <div class="header">
    <div class="header-left">
      <span class="iconfont">&#xe624;</span>
    </div>
    <div class="header-search">
      <span class="iconfont">&#xe632;</span>
      输入城市/景点/游玩主题
    </div>
    <div class="header-right" @click="toCity">
      <!--路由跳转方法1-->
      <!--<router-link to="/city">
        西安<span class="iconfont">&#xe600;</span>
      </router-link>-->
      <!--路由跳转方法2-->
      {{ city }}<span class="iconfont">&#xe600;</span>
    </div>
  </div>
</template>
<script>
  import { mapState } from 'vuex'
  export default {
    methods:{
      toCity(){
        // this.$router.push('/city');
        this.$router.push({name:'city'});
      }
    },
    computed:{
      ...mapState(['city'])
    }
  }
</script>
<style scoped lang="stylus">
  @import "~css/var.styl"
  .header{
    background-color: $bgColor;
    width: 100%;
    line-height: .88rem;
    font-size: .28rem;
    display: flex;
    color: #ffffff;
    position: fixed;
    z-index:100;
  }
  .header-left{
    width: .4rem;
    text-align: center;
    padding: 0 .2rem;
    font-weight: 900;
  }
  .header-search{
    flex:1;
    height: .6rem;
    background-color: #fff;
    border-radius: .1rem;
    margin-top: .14rem;
    color:#e4e7ea;
    line-height: .6rem;
    padding-left: .2rem;
  }
  .header-right{
    padding: 0 .2rem;
  }
  a{
    color:#fff;
  }
</style>
